package D12_6z.Properties_2;

import java.io.FileWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class Demo1 {
    public static void main(String[] args) throws Exception {
        Map<String,String> map = new HashMap<>();
        map.put("pid","10");
        map.put("name","张三");
        map.put("age","18");
        Properties prop = new Properties();
        for (Map.Entry<String, String> r : map.entrySet()) {
            prop.setProperty(r.getKey(),r.getValue());
        }
        FileWriter fw = new FileWriter("mapdata.properties");
        prop.store(fw,"xxx");
        fw.close();
    }
}
